home *** CD-ROM | disk | FTP | other *** search
/ Total Network Tools 2002 / NextStepPublishing-TotalNetworkTools2002-Win95.iso / Archive / Misc Servers / Zope.exe / DTML-VAR.STX < prev    next >
Encoding:
Text File  |  2000-10-12  |  3.3 KB  |  114 lines

  1. var: Inserts a variable
  2.  
  3.   The 'var' tags allows you insert variables into DTML output.
  4.  
  5.   Syntax
  6.  
  7.     'var' tag syntax::
  8.  
  9.       <dtml-var Variable|expr="Expression">
  10.  
  11.     The 'var' tag is a singleton tag.  The 'var' tag finds a variable
  12.     by searching the DTML namespace which usually consists of current
  13.     object, the current object's containers, and finally the web
  14.     request.  If the variable is found, it is inserted into the DTML
  15.     output. If not found, Zope raises an error.
  16.  
  17.     'var' tag entity syntax::
  18.  
  19.       &dtml-variableName;
  20.  
  21.     Entity syntax is a short cut which HTML quotes the variable. It is
  22.     useful when inserting variables into HTML tags.
  23.  
  24.   Attributes
  25.  
  26.     html_quote -- Convert characters that have special meaning in
  27.     HTML to HTML character entities.
  28.  
  29.     missing=string -- Specify a default value in case Zope cannot find
  30.     the variable.
  31.  
  32.     fmt=string -- Format a variable. Zope provides a view built-in
  33.     formats including C-style format strings. For more information on
  34.     C-style format strings see the "Python Library
  35.     Reference":http://www.python.org/doc/current/lib/typesseq-strings.html
  36.  
  37.       whole-dollars -- Formats the variable as dollars.
  38.  
  39.       dollars-and-cents -- Formats the variable as dollars and cents.
  40.  
  41.       collection-length -- The length of the variable, assuming it is
  42.       a sequence.
  43.  
  44.       structured-text -- Formats the variable as Structured Text. For
  45.       more information on Structured Text see "Structured Text
  46.       How-To":http://www.zope.org/Members/millejoh/structuredText on
  47.       the Zope.org web site.
  48.  
  49.     null=string -- A default value to use if the variable is None.
  50.  
  51.     lower -- Converts upper-case letters to lower case. 
  52.  
  53.     upper -- Converts lower-case letters to upper case. 
  54.  
  55.     capitalize -- Capitalizes the first character of the inserted
  56.     word. 
  57.  
  58.     spacify -- Changes underscores in the inserted value to spaces.
  59.  
  60.     thousands_commas -- Inserts commas every three
  61.     digits to the left of a decimal point in values containing
  62.     numbers for example '12000' becomes '12,000'.
  63.  
  64.     url_quote -- Converts characters that have special meaning in
  65.     URLs to HTML character entities.
  66.  
  67.     url_quote_plus -- URL quotes character, like 'url_quote' but also
  68.     converts spaces to plus signs.
  69.  
  70.     sql_quote -- Converts single quotes to pairs of single
  71.     quotes. This is needed to safely include values in SQL strings.
  72.  
  73.     newline_to_br -- Convert newlines (including carriage returns) to
  74.     HTML break tags.
  75.  
  76.     size=arg -- Truncates the variable at the given length
  77.     (Note: if a space occurs in the second half of the truncated
  78.     string, then the string is further truncated to the right-most space).
  79.  
  80.     etc=arg -- Specifies a string to add to the end of a string
  81.     which has been truncated (by setting the 'size' attribute listed
  82.     above).  By default, this is '...'
  83.  
  84.   Examples
  85.  
  86.     Inserting a simple variable into a document::
  87.  
  88.       <dtml-var standard_html_header>
  89.  
  90.     Truncation. Suppose colors is the string 'red yellow green',
  91.     then::
  92.  
  93.       <dtml-var colors size=10 etc=", etc.">
  94.  
  95.     will produce the output::
  96.  
  97.       red yellow, etc.
  98.  
  99.     C-style string formatting::
  100.  
  101.       <dtml-var expr="23432.2323" fmt="%.2f">
  102.  
  103.     renders to::
  104.      
  105.       23432.23
  106.       
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.